/*
 * 文件名：ParkController.java
 * 版权：Copyright by www.nd.com
 * 描述：
 * 修改人：Administrator
 * 修改时间：2016年12月1日
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */

package com.liupf.controller;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Page;
import com.liupf.domain.City;
import com.liupf.domain.Notice;

public class ParkController extends Controller
{
    public void parkPlace(){
    	 String username=(String) this.getRequest().getSession().getAttribute("userName");
    	 Page<City> page;
    	  if(username.equals("admin"))
  	    {
  	        page = City.dao.paginate(getParaToInt(0, 1), 10,
                  "select * ",
                  "from b_city where 1=1 order by id desc");
  	    }
  	    else{
  	        String company = (String) this.getRequest().getSession().getAttribute("cityId");
  	        
  	        page = City.dao.paginate(getParaToInt(0, 1), 10,
  	                "select * ",
  	                "from b_city where id=? order by id desc", company);
  	    }
        /*Page<City> page = City.dao.paginate(getParaToInt(0, 1), 10,
                "select * ",
                "from b_city order by id desc");*/
        setAttr("page", page);
        
        //String commond=(String) this.getRequest().getParameter("commond");
        render("parkPlace.ftl");
        //forwardAction("parkPlace.ftl");
        //redirect("parkPlace.ftl", true);
    }
    
    public void parkPrice(){
    	 String username=(String) this.getRequest().getSession().getAttribute("userName");
    	 Page<City> page;
    	  if(username.equals("admin"))
  	    {
  	        page = City.dao.paginate(getParaToInt(0, 1), 10,
                  "select * ",
                  "from b_city where 1=1 order by id desc");
  	    }
  	    else{
  	        String company = (String) this.getRequest().getSession().getAttribute("cityId");
  	        
  	        page = City.dao.paginate(getParaToInt(0, 1), 10,
  	                "select * ",
  	                "from b_city where id=? order by id desc", company);
  	    }
        /*Page<City> page = City.dao.paginate(getParaToInt(0, 1), 10,
                "select * ",
                "from b_city order by id desc");*/
        setAttr("page", page);
        
        //String commond=(String) this.getRequest().getParameter("commond");
        render("parkPrice.ftl");
        //forwardAction("parkPlace.ftl");
        //redirect("parkPlace.ftl", true);
    }
}
